/**
 * @author liangxi
 * @since 2024/3/28
 */

#ifndef LOGGER_LOG_H
#define LOGGER_LOG_H

#include <string>

/**
 * 日志类实体
 */
class Log {

public:

    ///输出日志等级
    enum class LogLevel {
        Debug = 0,
        Info,
        Warning,
        Error,
        Fatal
    };

    ///输出日志目标
    enum class Output {
        Console = 0,
        File
    };

    Log(Output &mOutput, const std::string &mContent, const std::string &mFileName,
        const std::string &mPath)
            : mOutput(mOutput), mContent(mContent), mFileName(mFileName), mPath(mPath) {}

    ///返回输出目标类型
    Output getMOutput() const { return mOutput; }
    ///返回输出内容
    const std::string &getMContent() const { return mContent; }
    ///返回输出目标文件名
    const std::string &getMFileName() const { return mFileName; }
    ///返回输出目标文件路径
    const std::string &getMPath() const { return mPath; }

    static std::string levelToString(Log::LogLevel &level) {
        switch (level) {
            case Log::LogLevel::Debug:
                return "Debug";
            case Log::LogLevel::Info:
                return "Info";
            case Log::LogLevel::Warning:
                return "Warning";
            case Log::LogLevel::Error:
                return "Error";
            case Log::LogLevel::Fatal:
                return "Fatal";
            default:
                return "Undefined";
        }
    }

private:
    Output mOutput;
    std::string mContent;
    std::string mFileName;
    std::string mPath;
};


#endif //LOGGER_LOG_H
